<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../../org/angular.min.js"></script>
</head>

<body ng-app="app" ng-controller="ctrl">
    <table border="1" width="300">
        <tr>
            <th>姓名</th>
            <th>手机号</th>
        </tr>
        <tr ng-repeat="u in data">
            <td>{{u.name}}</td>
            <td>{{u.phone|truncate:3}}</td>
        </tr>
    </table>
    <script>
        var m = angular.module('app', []);
        m.filter('truncate', function() {
            return function(str, len) {

                return str.substr(0, 11 - len) + new String('*').repeat(3);
            }
        })
        m.controller('ctrl', ['$scope', function($scope) {
            $scope.data = [{
                    name: '周老师',
                    phone: '18547271205'
                },
                {
                    name: '李老师',
                    phone: '13900000888'
                },
                {
                    name: '王老师',
                    phone: '13000299806'
                }
            ];
        }])
    </script>
</body>

</html>
